# 数据审查业务类
import os

import pandas as pd


class DataCheckServer:
    def __init__(self,dir_path):
        """
        数据检查，初始化
        :param dir_path: 工作目录路径
        """
        self.账页文件_list = []
        self.记账概览_list = []
        self.M卷_list = []
        self.A卷_list = []
        self.B卷_list = []
        self.E卷_list = []
        self.F卷_list = []
        self.G卷_list = []
        self.账页_data_frame = pd.DataFrame([])
        self.记账概览本月_data_frame = pd.DataFrame([])
        self.记账概览上月_data_frame = pd.DataFrame([])
        self.M卷_data_frame = pd.DataFrame([])
        self.A卷_data_frame = pd.DataFrame([])
        self.B卷_data_frame = pd.DataFrame([])
        self.E卷_data_frame = pd.DataFrame([])
        self.F卷_data_frame = pd.DataFrame([])
        self.G卷_data_frame = pd.DataFrame([])
        pass
        # 加载对应文件的pandas数据

    def filetype_correspond_pandas(self, file_path: str) -> pd.DataFrame:
        """
        加载对应文件的pandas数据
        :param file_path: 文件路径
        :return: DataFrame
        """
        file_extension = os.path.splitext(file_path)[1]
        file_type = file_extension[1:]
        if file_type == 'csv':
            return pd.read_csv(file_path, encoding='GBK')
        elif file_type == 'xlsx' or file_type == 'xls':
            return pd.read_excel(file_path)
        print("文件格式不对")

    # TODO 展示不实现编码识别
    def get_file_encoding(self, file_path: str) -> str:
        """
        获取文件编码
        """
        open_file = open(file_path, 'r', encoding='utf-8')


if __name__ == '__main__':
    i = 0
    st = f"{i}ok"
    print(st)
